package com.lovo.pz.window;

import com.lovo.pz.util.GameMusic;
import com.lovo.pz.util.GameUtil;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

/**
 * 欢迎面板
 */
public class WelcomePanel extends JPanel implements MouseListener {
    private MainFrame mainFrame;
    public WelcomePanel(MainFrame mainFrame){
        this.mainFrame = mainFrame;
        this.addMouseListener(this);
        GameMusic.playLoopMusic(GameUtil.mainMusic);
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.drawImage(GameUtil.welcomeImage,0,0,this);
    }

    @Override
    public void mouseClicked(MouseEvent e) {
        mainFrame.switchPanel("menu");
    }

    @Override
    public void mousePressed(MouseEvent e) {

    }

    @Override
    public void mouseReleased(MouseEvent e) {

    }

    @Override
    public void mouseEntered(MouseEvent e) {

    }

    @Override
    public void mouseExited(MouseEvent e) {

    }
}
